<?php

require_once 'config/config.php';

$username = $_POST['username'];
$password = $_POST['password'];

$query = 'SELECT password FROM users WHERE username = "'.$username.'"';
$result = mysql_query($query);

if(mysql_num_rows($result) == 1) {
    $line = mysql_fetch_assoc($result);
    $user_password = $line['password'];
    
    if(crypt($password, $user_password) === $user_password) {
        echo 'LOGINOK';
    }else {
        echo 'LOGINFAIL';
    }
    
} else {
    
    echo 'LOGINFAIL';
    
}

?>
